<template>
    <div class="tab-bar">
        <slot></slot>
    </div>
</template>

<script setup>
import useChildren from '@/hooks/useChildren';
// import { provide } from 'vue';

const { linkChildren } = useChildren('TabBar');
const props = defineProps({
    //通过v-model函数产生的modelValue属性
    modelValue: {
        type: Number,
    },
})


const setActive = (index) => {
    emit('update:modelValue', index);
}
const emit = defineEmits(['update:modelValue']);

linkChildren({
    props,
    setActive,
});


</script>

<style scoped>
.tab-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: space-around;
    height: 40px;
    background-color: skyblue;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3);
}
</style>